from django.conf.urls import url
from . import setviews
from rest_framework.routers import SimpleRouter,DefaultRouter # 首页跟路径不同
urlpatterns = [
    # url(r'^books/$', genericapiviews.Books.as_view()),
    # url(r'^books/(?P<pk>\d+)/$', genericapiviews.Book.as_view()),

    # url(r'^books/$', setviews.Book.as_view({'get':'list'})),
    # url(r'^books/(?P<pk>\d+)/$', setviews.Book.as_view({'put': 'update'})),

    # url(r'^books/$', setviews.BooksMedolSet.as_view({'get':'list','post':'create'})),
    # url(r'^books/(?P<pk>\d+)/$', setviews.BooksMedolSet.as_view({'put': 'update', 'get': 'retrieve'})),
]
#　自动生成模型视图集的路由
router = SimpleRouter()
router.register('books', setviews.BooksMedolSet, base_name='123')
urlpatterns += router.urls